import pandas as pd
import matplotlib.pyplot as plt


def image_psll_out_ori(path_y_out_test):
    # 读取CSV文件
    df = pd.read_csv(path_y_out_test)
    # 创建图形和轴
    plt.figure(figsize=(12, 6))
    # 绘制折线图
    plt.plot(df['psll_ori'], color='black', linestyle='--', linewidth=1.5, label='Real', zorder=5)
    plt.plot(df['psll_out'],  color='blue', linewidth=2, label='Proposed')
    # 添加标题和标签
    # plt.title('Plot of psll_ori, psll_enc, and psll_out', fontsize=14)
    plt.xlabel('Index', fontsize=12)
    plt.ylabel('PSLL', fontsize=12)
    # 添加图例
    plt.legend(fontsize=12)
    # 显示图形
    plt.grid(True, alpha=0.5)
    plt.tight_layout()
    plt.show()


def image_psll_out_0_4(path_y_out_0, path_y_out_1, path_y_out_2, path_y_out_3, path_y_out_4):
    # 读取CSV文件
    df_0 = pd.read_csv(path_y_out_0)
    df_1 = pd.read_csv(path_y_out_1)
    df_2 = pd.read_csv(path_y_out_2)
    df_3 = pd.read_csv(path_y_out_3)
    df_4 = pd.read_csv(path_y_out_4)
    # 创建图形和轴
    plt.figure(figsize=(12, 6))
    # 绘制折线图
    plt.plot(df_0['psll_out'], color='red', linewidth=2, label='t=1')
    plt.plot(df_1['psll_out'], color='blue', linewidth=2, label='t=2')
    # plt.plot(df_2['psll_out'], color='green', linewidth=2, label='t=3')
    # plt.plot(df_3['psll_out'], color='purple', linewidth=2, label='t=4')
    # plt.plot(df_4['psll_out'], color='gray', linewidth=2, label='t=5')
    # 添加标题和标签
    # plt.title('Plot of psll_ori, psll_enc, and psll_out', fontsize=14)
    plt.xlabel('Index', fontsize=12)
    plt.ylabel('PSLL', fontsize=12)
    # 添加图例
    plt.legend(fontsize=12)
    # 显示图形
    plt.grid(True, alpha=0.5)
    plt.tight_layout()
    plt.show()


if __name__=="__main__":
    # 画 t=0 时刻, 真实值 和 预测值
    # image_psll_out_ori("y_out_psll_point.csv")
    # 画 t=0, t=1, t=2, t=3, t=4 时刻, 预测值
    image_psll_out_0_4("y_out_psll_point-2025-11-11-0.csv",
                       "y_out_psll_point-2025-11-11-1.csv",
                       "y_out_psll_point-2025-11-11-2.csv",
                       "y_out_psll_point-2025-11-11-3.csv",
                       "y_out_psll_point-2025-11-11-4.csv")